/**
 * @purpose DAO的基本接口
 * @author daizs
 * @created Feb 9, 2010
 */
package platform.common.dao;

import java.util.List;
import java.util.Map;

import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.springframework.orm.hibernate3.HibernateTemplate;

import platform.common.bo.Page;
import platform.common.dao.impl.DaoConfigException;
import platform.common.dao.impl.DaoException;


import platform.common.dao.IDomainProvider;
import platform.common.dao.INestSetTreeDao;

public interface IDao extends INestSetTreeDao {

	/**
	 * 以服务器端游标的方式查询
	 *
	 * @param domainProvider
	 *            领域提供者
	 * @param queryName
	 *            查询定义别名
	 * @param qryParams
	 *            查询参数数组
	 * @return 领域列表的服务器端游标
	 * @throws DaoException,
	 *             DaoConfigException
	 */
	public ScrollableResults findScrollableResultsByHqlNameAndDomian(
			IDomainProvider domainProvider, String queryName, Object[] qryParams)
			throws DaoException, DaoConfigException;

	/**
	 * 依据领域名称和查询定义别名查询记录
	 *
	 * @param domainProvider
	 *            领域提供者
	 * @param queryName
	 *            查询定义别名
	 * @param qryParams
	 *            查询参数Map
	 * @return 领域列表的服务器端游标
	 * @throws DaoException,
	 *             DaoConfigException
	 */
	@SuppressWarnings("unchecked")
	public ScrollableResults findScrollableResultsByHqlNameAndDomian(
			IDomainProvider domainProvider, String queryName, Map qryParamMap)
			throws DaoException, DaoConfigException;

	/**
	 *
	 * <br/>方法描述:执行动态hql
	 *
	 * @param queryName
	 *            hql别名(领域提供者get后面一段)
	 * @param dynamicMap
	 *            动态构造hql的参数
	 * @param hqlParamMap
	 *            为hql语句赋值
	 * @throws DaoConfigException
	 */
	@SuppressWarnings("unchecked")
	public void exeDynamicHql(IDomainProvider domainProvider, String queryName,
			Map dynamicMap, Map hqlParamMap) throws DaoException,
			DaoConfigException;

	/**
	 *
	 * <br/>方法描述:依据动态hql查询
	 *
	 * @param queryName
	 *            hql别名(领域提供者get后面一段)
	 * @param dynamicMap
	 *            动态构造hql的参数
	 * @param hqlParamMap
	 *            为hql语句赋值
	 * @throws DaoConfigException
	 */
	public <T>T findByDynamicHql(IDomainProvider domainProvider,
			String queryName, Map<String,Object> dynamicMap, Map<String,Object> hqlParamMap)
			throws DaoException, DaoConfigException;
	public <T>T findByDynamicHql(String queryName, Map<String,Object> dynamicMap, Map<String,Object> hqlParamMap)
			throws DaoException, DaoConfigException;
	/**
	 *
	 * <br/>方法描述:依据动态hql查询
	 *
	 * @param queryName
	 *            hql别名(领域提供者get后面一段)
	 * @param dynamicMap
	 *            动态构造hql的参数
	 * @param hqlParamMap
	 *            为hql语句赋值
	 * @param page
	 *            分页信息
	 * @throws DaoConfigException
	 */
	@SuppressWarnings("unchecked")
	public List findByDynamicHql(IDomainProvider domainProvider,
			String queryName, Map dynamicMap, Map hqlParamMap,Page page)
		throws DaoException, DaoConfigException;
	@SuppressWarnings("unchecked")
	public List findByDynamicHql(String queryName, Map dynamicMap, Map hqlParamMap,Page page)
		throws DaoException, DaoConfigException;
	
	public Session getMySession();
	public HibernateTemplate getMyHibernateTemplate();
	
}
